package com.lxq.LeetCode.hammingWeight;

public class Solution {
    public static void main(String[] args) {

    }
    public static int hammingWeight(int n) {
        int res = 0;
        while (n != 0) {
            n &= n - 1;
            res++;
        }
        return res;
    }
}
